#define _CRT_SECURE_NO_WARNINGS 1
#include"SList.h"


void testSLT1()
{
	SLNode* plist = NULL;
	SLTPushback(&plist, 1);
	SLTPushback(&plist, 2);
	SLTPushback(&plist, 3);
	SLTPushback(&plist, 4);
	SLTPushback(&plist, 5);

	SLTPrint(plist);

	SLTPopback(&plist);
	SLTPrint(plist);

	SLTPopback(&plist);
	SLTPrint(plist);

	SLTPopback(&plist);
	SLTPrint(plist);

	SLTPopback(&plist);
	SLTPrint(plist);

	SLTPopback(&plist);
	SLTPrint(plist);

	/*SLTPopback(&plist);
	SLTPrint(plist);*/

}

void testSLT2()
{
	SLNode* plist = NULL;
	SLTPushfront(&plist, 1);
	SLTPushfront(&plist, 2);
	SLTPushfront(&plist, 3);
	SLTPushfront(&plist, 4);
	SLTPushfront(&plist, 5);

	SLTPrint(plist);

	SLNode* pos = SLTFind(plist, 3);
	SLTInsert(&plist, pos, 30);
}

void testSLT3()
{
	SLNode* plist = NULL;
	SLTInsert(&plist, NULL, 1);
	SLTPrint(plist);

	SLTPushfront(&plist, 1);
	SLTPushfront(&plist, 2);
	SLTPushfront(&plist, 3);
	SLTPushfront(&plist, 4);
	SLTPrint(plist);

	SLNode* pos = SLTFind(plist, 4);
	SLTInsert(&plist, pos, 40);
	SLTPrint(plist);

	pos = SLTFind(plist, 2);
	SLTInsert(&plist, pos, 20);
	SLTPrint(plist);

}

void testSLT4()
{
	SLNode* plist = NULL;
	SLTPushback(&plist, 1);
	SLTPushback(&plist, 2);
	SLTPushback(&plist, 3);
	SLTPushback(&plist, 4);
	SLTPushback(&plist, 5);

	SLTPrint(plist);

	SLNode* pos = SLTFind(plist, 1);
	SLTErase(&plist, pos);
	SLTPrint(plist);

	pos = SLTFind(plist, 3);
	SLTErase(&plist, pos);
	SLTPrint(plist);
}

void testSLT5()
{
	SLNode* plist = NULL;
	SLTPushback(&plist, 1);
	SLTPushback(&plist, 2);
	SLTPushback(&plist, 3);
	SLTPushback(&plist, 4);
	SLTPushback(&plist, 5);

	SLTPrint(plist);

	SLNode* pos = SLTFind(plist, 1);
	SLTInsertAfter(pos, 10);
	SLTPrint(plist);
}

int main()
{
	testSLT5();

	return 0;
}